All Questions
28 questions
2votes
3answers
752views
Find median value of two Sorted Arrays
To improve my coding knowledge can you please give me suggested changes on my code? ...
2votes
1answer
112views
Codeforces: Dasha & Nightmares
so I got started with competitive programming about a day ago and I got stuck on the first random question I tried on codeforces. It's called Dasha and Nightmares. Problem Description: The problem ...
3votes
1answer
272views
Array rotation in C++
I am completely new to data structures and algorithms. I tried this problem on hackerank. I got the desired output but my code wasn't efficient enough to execute in the given time limit. How can I ...
1vote
1answer
369views
Google Foobar challenge optimization
I am trying to solve Google Foobar challenge prepare-the-bunnies-escape using my own approach, instead of BFS. I attempt to solve two ends of the maze and try to ...
2votes
1answer
563views
Calculate your total happiness, which depends on the integers in the given sets [closed]
I am a beginner in programming. And I am learning python as my first language. I went on to do some challenges on HackerRank and stumbled upon this problem. The problem goes like this: There is an ...
1vote
1answer
355views
The Great Julya Calendar
Challenge An integer is provided as an input. In each step, we have to subtract a number from the input which already exists as a digit of the input. In this way, we have to make the input equal ...
2votes
1answer
471views
CCC '19 S5:Triangle: The Data Structure
This problem is from [CCC2019]: https://dmoj.ca/problem/ccc19s5/ (Canadian Computing Contest 2019) and I have implemented it in C++. I used sequence [A054237]: https://oeis.org/A054237/table to ...
1vote
3answers
589views
Sum the largest five numbers
I'm doing a code-challenge problem: Input The first line consists of an integer T (T ≤ 100) which represents the number of test cases. Each test case consists of ...
6votes
1answer
257views
Counting primes in a range whose digits are all prime
Codewars Kata: Given integers a and b, count all primes p where a ≤ p < b and the digits of p are all prime. b may be as large as 107. To start with, I hardcoded all valid 1903 primes in \$[1, 10^...
5votes
1answer
550views
Codewars: N smallest elements in original order
I am consistently timing out on the mentioned kata: Task You will be given an array of random integers and a number n. You have to extract n smallest integers out of it preserving the original ...
3votes
2answers
235views
Project Euler #7: Nth prime number
I was solving Project Euler #7 on Hackerrank but for two cases, execution time is more than 2 sec. Can you help with optimizing? I'm new to programming. ...
9votes
2answers
665views
Project Euler #119 : Digit power sum
From problem #119 of the Project Euler : The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with ...
3votes
1answer
167views
Find the length of a frequency-change cycle (Advent of Code 2018)
I tried to do the second part of the 1. December challenge of Advent of Code in Haskell. I'm fairly new to Haskell but I have plenty of experience in other (procedural) languages. I struggled with the ...
0votes
1answer
1kviews
Project Euler Problem 1 with Python 3 ideal solution
I have been playing around in hacker rank with Python these days, and now pulling my hair out on this question to solve the Euler's problem in the least time required. If we list all the natural ...
8votes
1answer
333views
Beginner's attempt for Project Euler problem 12 (highly divisible triangle number)
I'm a couple weeks into learning Python and I'm working through the Project Euler problems. Problem 12 asks: What is the value of the first triangle number to have over five hundred divisors? My ...